/**
 * 
 */
package com.qccx.ueuo.selfguide.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.qccx.ueuo.selfguide.dao.UserDao;
import com.qccx.ueuo.selfguide.entity.User;

/**
 * 功能介绍:
 * @author rainJohn
 *
 * @date [2013-4-27]
 */
public class UserDaoImpl implements UserDao
{
    private SqlSession sqlSession;

    /**
     * 获取ibatisSession
     * 
     * @param sqlSession
     */
    public UserDaoImpl( SqlSession sqlSession )
    {
        this.sqlSession = sqlSession;
    }
    /* (non-Javadoc)
     * @see com.qccx.ueuo.selfguide.dao.UserDao#addUser(com.qccx.ueuo.selfguide.entity.User)
     */
    @Override
    public int addUser( User user )
    {
        return 0;
    }

    /* (non-Javadoc)
     * @see com.qccx.ueuo.selfguide.dao.UserDao#deleteUserById(int)
     */
    @Override
    public boolean deleteUserById( int id )
    {
        
        return false;
    }

    /* (non-Javadoc)
     * @see com.qccx.ueuo.selfguide.dao.UserDao#updateUser(com.qccx.ueuo.selfguide.entity.User)
     */
    @Override
    public int updateUser( User user )
    {
        
        return 0;
    }

    /* (non-Javadoc)
     * @see com.qccx.ueuo.selfguide.dao.UserDao#queryAllUser()
     */
    @SuppressWarnings( "unchecked" )
    @Override
    public List<User> queryAllUser()
    {
        List<User> userList = (List<User>)sqlSession.selectList( "user.queryAllUser" );
        return userList;
    }

    /* (non-Javadoc)
     * @see com.qccx.ueuo.selfguide.dao.UserDao#queryUserById(int)
     */
    @Override
    public User queryUserById( int id )
    {
        
        return null;
    }

    /* (non-Javadoc)
     * @see com.qccx.ueuo.selfguide.dao.UserDao#queryUserById(java.lang.String)
     */
    @Override
    public User queryUserByName(User user)
    {
        User u = null;
       try
       {
           u =(User)sqlSession.selectOne( "user.queryUserByName",user );
       }catch(Exception e)
       {
           e.printStackTrace();
       }
        return u;
    }
}
